export const getAttrVal = (el, name) => {
  if (!el && !name) return
  name = 'data-' + name
  return el.getAttribute(name)
}

export const setAttr = (el, name, value) => {
  name = 'data-' + name
  const attrValue = getAttrVal(el, name)
  if (attrValue) {
    const attrArr = attrValue.split(' ')
    attrArr.push(value)
    el.setAttribute(name, attrArr.join(' '))
    return
  }
  el.setAttribute(name, value)
}
